package com.sbj.dto.res;

import cn.zhxu.bs.bean.DbField;
import cn.zhxu.bs.bean.SearchBean;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.sbj.dto.jackson.CustomDecimalSerialize;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * @author summer
 * @version 1.0
 * @date 2024/8/10 17:12
 */
@Data
@SearchBean(tables = " member_order o LEFT JOIN member m ON o.member_id = m.id"  +
        " LEFT JOIN address a ON a.id=o.address_id " ,autoMapTo = "o",orderBy = "o.createTime DESC")
public class OrderRes implements Serializable {

    @DbField("o.id")
    private Integer id;

    @DbField("o.order_no")
    private String orderNo;

    @DbField("m.phone")
    private String nickNamePhone;

    @DbField("m.nickName")
    private String nickName;

    @DbField("o.order_state")
    private Integer  orderState;

    @DbField("(CASE WHEN o.order_state=0 THEN '未支付' WHEN o.order_state=1 THEN '待发货' WHEN o.order_state=2 THEN '待收货' WHEN o.order_state=3 THEN '已完成' ELSE '已取消' END)")
    private String stateName;

    @DbField("a.name")
    private String name;

    @DbField("a.address")
    private String address;

    @DbField("a.phone")
    private String phone;

    @DbField("o.createTime")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private LocalDateTime createTime;

    @DbField("o.pay_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private LocalDateTime payTime;




}
